/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.catosist.run.dataaccess.domain.hibernate;

import com.catosist.run.dataaccess.base.hibernate.HibernateGenericDAO;
import com.catosist.run.dataaccess.domain.DocpersDao;
import com.catosist.run.dataaccess.model.DocpersIdVO;
import com.catosist.run.dataaccess.model.DocpersVO;
import com.catosist.run.dataaccess.model.GastoVO;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author Bicho
 */
public class HibernateDocpersDao extends HibernateGenericDAO<DocpersVO, DocpersIdVO> implements DocpersDao {

    public HibernateDocpersDao() {
        super(DocpersVO.class);
    }

    public List<DocpersVO> getByPersonaId(int personaId) {
        DetachedCriteria detachedCriteria = DetachedCriteria.forClass(DocpersVO.class);
        detachedCriteria.add(Restrictions.eq("persona.id", personaId));
        detachedCriteria.addOrder(Order.desc("ffin"));
        List<DocpersVO> DocpersVOs = listByCriteria(detachedCriteria);
        return DocpersVOs;
    }
}
